package com.example.demo01.Controller.mobileController;

import com.alibaba.fastjson.JSON;
import com.example.demo01.Entity.mobileEntity.ServicePointEntity;
import com.example.demo01.Service.mobileService.ServePointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ServePointController {
    @Autowired
    private ServePointService servePointService;


    /**
     * 获取超市点集合
     */
    @RequestMapping("/servepoint/GET/supermarket")
    public String getSuperMarketList(
            @RequestParam(value = "lng") String lng,
            @RequestParam(value = "lat") String lat) { return JSON.toJSONString(servePointService.getSuperMarketList(lng, lat));}

    /**
     * 获取医疗点集合
     */
    @RequestMapping("/servepoint/GET/hospital")
    public String getHospitalList( @RequestParam(value = "lng") String lng,
                                   @RequestParam(value = "lat") String lat) {return JSON.toJSONString(servePointService.getHospitalList(lng, lat)); }

    /**
     * 获取休闲点集合
     */
    @RequestMapping("/servepoint/GET/scenerypoint")
    public String getSceneryPointList( @RequestParam(value = "lng") String lng,
                                       @RequestParam(value = "lat") String lat) {return JSON.toJSONString(servePointService.getSceneryPointList(lng, lat));}

    /**
     * 获取(lng,lat)周围3km范围内的服务点
     * @param lng 经度
     * @param lat 纬度
     * @return (lng,lat)周围3km范围内的服务点列表
     */
    @RequestMapping(value = "/servepoint/GET/bydefaultbuffer")
    public String getServePointByBuffer(@RequestParam(value = "lng") String lng,
                                        @RequestParam(value = "lat") String lat) { return JSON.toJSONString(servePointService.getServePointByBuffer(lng,lat)); }
}
